{% load i18n mezzanine_tags comment_tags %}
<div id="comments">
    <form method="post" id="comment" action="{{ comment_url }}#comment">
        {% csrf_token %}

        {{ posted_comment_form.timestamp }}
        {{ posted_comment_form.security_hash }}
        {{ posted_comment_form.object_pk }}
        {{ posted_comment_form.content_type }}

        {% if not request.POST.replied_to %}
            {{ posted_comment_form.comment }}
            {{ posted_comment_form.timestamp }}
            {{ posted_comment_form.security_hash }}

            {{ posted_comment_form.name }}
            {{ posted_comment_form.email }}

        {% else %}
            {% fields_for unposted_comment_form %}
        {% endif %}
        <div class="form-actions">
            <input class="btn btn-primary btn-lg D_submit" type="button" value="{% trans "Comment" %}">
        </div>
    <div></div>
    </form>

    <script>
        $(function () {
            $('.reply').click(function () {
                $('.comment-reply-form').hide();
                $('.comment-reply-form').hide();
                $(this).siblings('.comment-reply-form').toggle();
            });
            $("textarea[name='comment']").each(function(){
                $(this).attr("class","class_comment");
            });;
            $(".D_submit").click(function () {
                var strs = $(this).parent().parent("form").find(".class_comment").val();
                if (strs != "" && strs != null) {
                    $(".D_submit").attr("type", "submit");
                } else {
                    alert("内容不能为空");
                }
            });
        });

    </script>
    <style>.input_id_honeypot {
        display: none !important;
    }</style>
    <ul id="D_photoGallery_comments" class="group-activity">
        {% comment_thread object_for_comments %}
    </ul>

</div>
